Skip to main content

FrontEndExecutable

WLJS
Execution environment
Notebook`Editor`FrontendObject`
Context
FrontEndExecutable[uid_String]

A static reference to a frontend object (see CreateFrontEndObject) like FrontEndRef.

Supported output forms

StandardForm used in the output Wolfram Language cells is defined as ViewBox decoration with a corresponding FrontEndRef as an input expression. This decoration is used as a sort of an empty widget to which any nested expression can output (Graphics, Plot and etc made using this method)

WLXForm produces a widget-like placeholder, which can be populated with a content. This is how Plot and other graphics function can output to a slides.

Application

Custom WLJS function

Use for custom defined WLJS functions i.e.

.js
core.MyCustomStuff = async (args, env) => {
env.element.innerText = "Hi dude!";
}

and then in the next cell

CreateFrontEndObject[MyCustomStuff[]]
tip

Use TagSetDelayed on MakeBoxes to apply it automatically, i.e.

MyCustomStuff /: MakeBoxes[m_MyCustomStuff, StandardForm] := With[{
o = CreateFrontEndObject[m]
},
MakeBoxes[m, StandardForm]
]

then you don't need to manually create a frontend object anymore. Or even better - if your expression is not too big one can bypass frontend objects at all

MyCustomStuff /: MakeBoxes[m_MyCustomStuff, StandardForm] := ViewBox[m,m]